#pragma once
#include "Globals.h"

//This class holds all the message currently in the game and sends them to their desired targets
// Each message has data, a type flag, and a destination
//
// The GAME manager communicates with the messanger to check if it has any messages that need to be passed out
// If it does, it finds the target, and has the target translate the message. If the target cannot translate the
// message it gets rid of it. (To ensure that no useless messages stay in the message list)
//
// If an object needs to send a message, it passes it through the Messenger singleton via the SendMessagA().
// On the next update it gets passed out if it has a valid target.
class Messenger
{
	Messenger(){}
	Vector<Message*> AllMessages;
public:
	inline static Messenger* Engine()
	{
		static Messenger MyMessages;
		return &MyMessages;
	}

	
	~Messenger(){}
	void SendMessageA(eMessage MessageType,float const & Info,int const & Receiver);
	void ReceiveMessages(void* Receiver);
	void ClearMessage(Message* Msg);
};